﻿@model ProductAttributeModel

@if (Model.Id > 0)
{
    <div class="panel-body">
        <p>
            @T("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Hint")
        </p>
        @await Html.PartialAsync("Table", new DataTablesModel
        {
            Name = "used-by-products-grid",
            UrlRead = new DataUrl("UsedByProducts", "ProductAttribute", new RouteValueDictionary { [nameof(Model.ProductAttributeProductSearchModel.ProductAttributeId)] = Model.ProductAttributeProductSearchModel.ProductAttributeId }),
            Length = Model.ProductAttributeProductSearchModel.PageSize,
            LengthMenu = Model.ProductAttributeProductSearchModel.AvailablePageSizes,
            ColumnCollection = new List<ColumnProperty>
            {
                new ColumnProperty(nameof(ProductAttributeProductModel.ProductName))
                {
                    Title = T("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Product").Text,
                    Width = "400"
                },
                new ColumnProperty(nameof(ProductAttributeProductModel.Published))
                {
                    Title = T("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Published").Text,
                    Width = "100",
                    ClassName =  NopColumnClassDefaults.CenterAll,
                    Render = new RenderBoolean()
                },
                new ColumnProperty(nameof(ProductAttributeProductModel.Id))
                {
                    Title = T("Admin.Common.View").Text,
                    Width = "100",
                    ClassName =  NopColumnClassDefaults.Button,
                    Render = new RenderButtonView(new DataUrl("~/Admin/Product/Edit/"))
                }
            }
        })
    </div>
}
